package com.dbs;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.cloud.client.SpringCloudApplication;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.zuul.EnableZuulProxy;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

import com.dbs.filter.TestFilter;

@SpringCloudApplication // @SpringBootApplication，@EnableDiscoveryClient，@EnableCircuitBreaker的结合体
						// 理解为cloud专属注解
// @SpringBootApplication
// 注解开启Zuul
@EnableZuulProxy
//zuul默认是开启负载均衡的
//开启断路器功能
//@EnableCircuitBreaker
public class ZuulApplication {

	public static void main(String[] args) {
		new SpringApplicationBuilder(ZuulApplication.class).web(true).run(args);
		// SpringApplication.run(ZuulApplication.class, args);
	}

	/*@Bean
	// 开启均衡负载能力
	@LoadBalanced
	// 不能private 应该是因为这是配置文件@bean
	RestTemplate restTemplate() {
		return new RestTemplate();
	}*/
	
	@Bean
	public TestFilter accessFilter() {
		return new TestFilter();
	}
}
